package com.suikajy.layoutmanagerdemo;

import android.graphics.Rect;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.view.View;
import android.widget.RelativeLayout;

import butterknife.Bind;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Bind(R.id.rv)
    RecyclerView mRv;
    @Bind(R.id.fab)
    FloatingActionButton mFab;
    @Bind(R.id.activity_main)
    RelativeLayout mActivityMain;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        initView();
    }

//    private void initView() {
//        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
//        mRv.setLayoutManager(linearLayoutManager);
//        mRv.setAdapter(new MyAdapter());
//    }

    private void initView() {
        MyLinearLayoutManager manager=new MyLinearLayoutManager();
        mRv.setLayoutManager(manager);
        mRv.setAdapter(new MyAdapter());
        mRv.addItemDecoration(new RecyclerView.ItemDecoration() {
            @Override
            public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
                super.getItemOffsets(outRect, view, parent, state);
            }
        });
    }

    @Override
    public void onClick(View v) {
        // TODO: 2016/12/8 fab 的点击事件
        SparseArray
    }
}
